package com.geokon.test.demo1.utils;

import java.util.Date;

public class YunweiUtil {
    /**
     * 计算给定时间加上指定秒数后的时间
     *
     * @param time 起始时间
     * @param diff 要添加的秒数
     * @return 计算后的时间
     */
    public static Date calTime(Date time, Integer diff) {
        if (time == null || diff == null) {
            return time;
        }
        long timeInMillis = time.getTime();
        long newTimeInMillis = timeInMillis + diff * 1000;
        return new Date(newTimeInMillis);
    }
}
